//
// Created by francklinson on 2021/10/23 AT 12:50.
//
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <functional>
#include <climits>
#include <string>
#include "../myTool.h"

//using namespace std;
class Base {
public:
    Base() {}

    virtual ~Base() {}
};

class Derived : public Base {
public:
    Derived() {}

    ~Derived() {}
};

class AnotherClass : public Base {
public:
    AnotherClass() {}

    ~AnotherClass() {}
};

int main() {
    // static_cast
    double value = 5.5f;
    double a = (int) value + 6.2f;
    double c = static_cast<int>( value) + 6.2f;
    // dynamic_cast 在类继承关系之间转换时使用
    // 从子类cast到父类 都没问题
    // 从父类cast到子类时，dynamic_cast会判断 这个父类对象能不能转换成子类对象 如果失败 返回null
    // 根据RTTI运行 run time type identification
    // 可以用来判断类型 类似isinstance of
    Derived *derived = new Derived();
    Base *base = derived;
    auto *ac = dynamic_cast<Derived *>(base);
    if (ac) {
        std::cout << "yes" << std::endl;
    } else
        std::cout << "No" << std::endl;
    int num = 2;



    return 0;
}

